#pragma once
#include "chord.hpp"
#include "const.hpp"

template <typename Freq = IntConst<440>, 
          typename Chord = EnumConst<Chord, MAJOR_CHORD>, 
          typename Tempo = IntConst<120> >
class Arpeggio
{
public:
    Arpeggio(): time_(0) {}
    float operator()()
    {
        ++time_;
        const int P = SAMPLE_RATE * 60 / tempo_();
        return freq_() * pow(2, Chords[chord_()][time_ % P * 4 / P] / 12.0);
    }
private:
    int time_;

    Freq freq_;
    Tempo tempo_;
    Chord chord_;
};

